%% theorems.sty
%%
%% Crated and mantained by Juan Antonio Navarro, juannavarroperez@gmail.com
%% http:\\www.udlap.mx\~ma108907\latex
%%
%% Usage example:
%%   \usepackage[section,onecounter,english]{theorems}
%% 
%% Available options:
%%   section|chapter|document - Number theorems within a particular sectional unit.
%%   onecounter|manycounters  - Whether to use one or different counters for theorems, lemmas, etc.
%%   english|spanish          - Select language.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{theorems}[2002/10/28 Definitions for theorem like environments]

\RequirePackage{amsthm}

\newcommand{\@newthm}{}
\newcommand{\@newsthm}{}
\newcommand{\@namesfile}{}

\DeclareOption{section}{\renewcommand{\@newthm}[2]{\newtheorem{#1}{#2}[section]}}
\DeclareOption{chapter}{\renewcommand{\@newthm}[2]{\newtheorem{#1}{#2}[chapter]}}
\DeclareOption{document}{\renewcommand{\@newthm}[2]{\newtheorem{#1}{#2}}}
\DeclareOption{onecounter}{\renewcommand{\@newsthm}[2]{\newtheorem{#1}[theorem]{#2}}}
\DeclareOption{manycounters}{\renewcommand{\@newsthm}[2]{\@newthm{#1}{#2}}}
\DeclareOption{english}{\renewcommand{\@namesfile}{english.nms}}
\DeclareOption{spanish}{\renewcommand{\@namesfile}{spanish.nms}}
\ExecuteOptions{english,section,manycounters}
\ProcessOptions\relax

\input{\@namesfile}

\@newthm{theorem}{\theoremname}
\@newsthm{lemma}{\lemmaname}
\@newsthm{corollary}{\corollaryname}
\@newsthm{proposition}{\propositionname}
\@newsthm{conjecture}{\conjecturename}

\theoremstyle{definition}
\@newsthm{definition}{\definitionname}
\@newsthm{example}{\examplename}
\@newsthm{problem}{\problemname}
\@newsthm{exercise}{\exercisename}
\@newsthm{notation}{\notationname}
\@newsthm{falgorithm}{\algorithmname}
\newcommand{\falgorithmname}{\algorithmname}
\@newsthm{note}{\notename}
\newtheorem*{acknowledgment}{\acknowledgmentname}

\theoremstyle{remark}
\newtheorem*{remark}{\remarkname}
\newtheorem*{claim}{\claimname}
\newtheorem*{solution}{\solutionname}
